﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Spring.Context.Support;


namespace VisualAgile.DTO.Mappers
{
    public class BaseDTOMapper
    {
        static AllManagerFactory _manager;

        public static  AllManagerFactory ManagerFactory
        {
            get
            {
                if (Manager != null) return Manager;                         

                var webApplicationContext =
                             ContextRegistry.GetContext() as WebApplicationContext;
                AllManagerFactory manager =
                    webApplicationContext.GetObject("ManagerFactory") as AllManagerFactory;

                return manager;
            }           
        }

        public static AllManagerFactory Manager
        {
            get
            {
                return _manager;
            }
            set
            {
                _manager = value;
            }
        }
        
    }

    public static class Extensions
    {
        public static DateTime ToLocalTime(this DateTime UTC)
        {
            return TimeZone.CurrentTimeZone.ToLocalTime(UTC);
        }
       
    }
}
